<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <title>后台管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/js/layui/css/layui.css}" media="all"/>
    <link rel="stylesheet" th:href="@{/css/login.css}" media="all"/>
    <script type="text/javascript" th:src="@{/js/layui/layui.all.js}"></script>
</head>
<body id="LAY_app">
<div class="main">
    <div class="header">
        <span class="logo" style=""></span>
        <span class="logoName">达梦数据管理平台</span>
    </div>
    <div class="content">
        <div class="a">
            <div class="login_main">
                <div class="layui-form">
                    <div class="row1">
                        <h1>登录</h1>
                    </div>
                    <div class="row2">
                        <ul>
                            <li><input type="text" name="username" id="username" lay-verify="required" placeholder="用户名" class="layui-input input"><i class="layui-icon">&#xe66f;</i></li>
                            <li><input type="password" name="password" id="password" lay-verify="required" placeholder="密码" class="layui-input input"><i class="layui-icon">&#xe673;</i></li>
                            <li>
                                <a href="javascript:do_tip();" class="right">忘记密码？</a>
                                <input type="checkbox" id="remember-me" name="remember-me" title="记住密码" lay-skin="primary">
                            </li>
                            <li class="tijiao">
                                <button class="layui-btn layui-btn-fluid layui-btn-login" lay-submit lay-filter="do_login">登录</button>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div style="text-align: center; margin-top: 20px;">
        <div>
            <div>
                达梦数据库有限公司
                <br/>
                Copyright © 2015-2020 | Wuhan Dameng Database All Rights Reserved
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" th:inline="javascript">
    /*<![CDATA[*/
    var ctxPath = /*[[@{/}]]*/ '';
    /*]]>*/

    ;!function(){
        var $ = layui.$
            ,layer = layui.layer
            ,form = layui.form;

        if (top != self) {
            top.location = self.location;
        }

        form.render();
        $("#login-username").focus();

        $('.layadmin-user-jump-change').click(function () {
            layer.msg('请联系管理员注册账号！', {
                offset: '15px',
                icon: 6,
                time: 3000
            });
        });

        //提交
        form.on('submit(do_login)', function (obj) {
            if ($(".layui-btn-fluid").hasClass("layui-btn-disabled")) {
                return false;
            }
            $(".layui-btn-fluid").addClass("layui-btn-disabled");
            $.post(
                ctxPath + 'loginVlidate'
                ,obj.field
                ,function(result){
                    if (result.status == 200) {
                        layer.msg(result.msg.name + ' 欢迎登录！', {
                            icon: 1,
                            time: 1000
                        }, function () {
                            location.replace(ctxPath + "index");
                        });
                    } else {
                        layer.msg(result.msg, {
                            icon: 5,
                            shift: 6,
                            time: 1500,
                            end: function () {
                                $(".layui-btn-fluid").removeClass("layui-btn-disabled");
                            }
                        });
                    }
                }
            );
        });
        // 回车提交
        $(document).keyup(function (event) {
            if (event.keyCode == 13) {
                $(".layui-btn-fluid").click();
            }
        });
    }();
</script>
</body>
</html>